#!/usr/bin/python
# -*- coding: utf-8 -*-

from google.appengine.ext import db

class Document(db.Model):
    title = db.StringProperty(required=True)
    order = db.IntegerProperty(required=True)
    text = db.TextProperty(required=True)

    def get_absolute_url(self):
        return "/diveintopython/belgeler/%s/" % self.id

    def get_translate_url(self):
        return "/diveintopython/ceviriler/ekle/%s/" % self.id

class Translation(db.Model):
    title = db.StringProperty(required=True)
    text = db.TextProperty()
    document = db.ReferenceProperty(Document)
    translator = db.UserProperty(required=True)

    created = db.DateTimeProperty(auto_now_add=True)
    modified = db.DateTimeProperty(auto_now=True)
    lastmodifier = db.UserProperty(required=True)

    is_locked = db.BooleanProperty()
    is_done = db.BooleanProperty()

    def get_absolute_url(self):
        return "/diveintopython/ceviriler/%s/" % self.id
